<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<h2><bean:message  bundle="content" key="list.title" /></h2>

<table id="hor-zebra" summary="">
    <thead>
    	<tr>
        	<th scope="col"><bean:message  bundle="content" key="list.table.coltitle" /></th>
            <th scope="col"><bean:message  bundle="content" key="list.table.coldesc" /></th>
            <th scope="col"><bean:message  bundle="content" key="list.table.colsize" /></th>
            <th scope="col"><bean:message  bundle="content" key="list.table.coluploaddate" /></th>
            <th scope="col"><bean:message  bundle="content" key="list.table.colactions" /></th>
        </tr>
    </thead>
    <tbody>
		<logic:iterate name="documents" id="docIt" indexId="counter">
		    <bean:define id="remainder" value="<%=Integer.toString(counter.intValue() % 2) %>"/>
			<logic:equal name="remainder" value="0">
				<tr>
			</logic:equal>
			<logic:notEqual name="remainder" value="0">
			    <tr class="odd">
			</logic:notEqual>
	        	<td><bean:write name="docIt" property="title"/> </td>
	            <td><bean:write name="docIt" property="description"/></td>
	            <td><bean:write name="docIt" property="sizeFormated"/> bytes</td>
	            <td><bean:write name="docIt" property="uploadedAt"  bundle="format" formatKey="format.date.short"/></td>
	            <td>
	            	<c:url var="urlDetail" scope="request" value="/document/detail.do">
			            <c:param name="id" value="${docIt.id}"/>
			            <c:param name="dispatch" value="detail"/>
			        </c:url>  
	    	        <a href="<c:out value="${urlDetail}" />"><bean:message  bundle="content" key="list.link.detail"/></a>
	            </td>
	        </tr>
		</logic:iterate>
    </tbody>
</table>

<hr />
<c:url var="urlNew" scope="request" value="/document/edit.do">
    <c:param name="dispatch" value="edit"/>
</c:url>  
<a href="<c:out value="${urlNew}" />">
	<bean:message  bundle="content" key="list.link.new"/>
</a>

